1. Field of the Invention
The present invention relates to an image reading apparatus, a method of controlling an image reading apparatus, and a storage medium.
2. Description of the Related Art
In a known image reading apparatus having a document conveying unit such as an ADF (Automatic Document Feeder), an image of a document is read by an image reading unit such as a line sensor while the document is conveyed. In such an image reading apparatus, dust or foreign particles can deposit on a document plate such as a document glass plate disposed between the image reading unit and the document. If there is a foreign substance on the document plate, it becomes difficult for the image reading unit to correctly read the image of the document. A specific problem is that a resultant read image can have a streak in an area corresponding to pixels at locations where there are foreign substances such as dust, foreign particles, etc. In view of the above, Japanese Patent Laid-Open No. 2002-176542 discloses a technique to make a correction on a read image to reduce an effect of dust or foreign particles.
In an image reading apparatus disclosed in Japanese Patent Laid-Open No. 2002-176542, the location of a foreign substance is detected by reading a document plate in a state in which there is no document on the document plate. Thereafter, the image reading apparatus reads a document, and makes a correction on a resultant read image such that a luminance value of a pixel at the location at which the foreign substance was detected is corrected by interpolation using luminance values of pixels adjacent in a main scanning direction to the pixel at the location where the foreign substance was detected.
However, in the correction process disclosed in Japanese Patent Laid-Open No. 2002-176542, the correction for pixels at which the foreign substance was detected before the document is read is performed unconditionally without taking into an account the possibility that the foreign substance disappears when the document is conveyed.
That is, even in a case where the foreign substance is removed in the middle of conveying the document, for example, by friction that occurs when the document is conveyed, the correction by the interpolation on the read image is continued. In this case, the value calculated using the interpolation is employed for the luminance value of the pixel at which there was initially a foreign substance but there is no longer foreign substance, although the correct luminance value of this pixel can be read and can be used for the luminance value of the pixel of interest. The employment of the luminance value calculated by interpolation for such a pixel causes degradation in the resultant luminance value for this pixel at which there was initially foreign substance but there is no longer foreign substance.